import {menulist} from '../../../request/api'

// 封装一个接口类型
interface StateMenu{
    menuList:Array<object>
}

const state = {
    menuList:[]
}

const getters = {
    getMenu(state:StateMenu){
        return state.menuList
    }
}

const mutations = {
    GETMENU(state:StateMenu,payload:any){
        state.menuList = payload
    }
}

const actions = {
    getMenuActions(context:any){
        menulist({istree:1}).then((res) => {
            // console.log(res);  
            context.commit('GETMENU',res.list)
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}